<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('延期申请审批')"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-delay-apprv">
        <input type="hidden" name="did" th:value="${delay.did}">
        <input type="hidden" name="tid" th:value="${delay.tid}">
        <div class="col-md-12">
            <div class="form-group">
                <label class="col-sm-3 control-label">任务标题：</label>
                <div class="col-sm-9">
                    <input type="text" name="" class="form-control" placeholder="请输入文本" th:value="${delay.info.target}"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">任务内容：</label>
                <div class="col-sm-9">
                    <input type="text" name="" class="form-control" placeholder="请输入文本" th:value="${delay.info.detail}"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">申请人：</label>
                <div class="col-sm-9">
                    <input type="text" name="" class="form-control" placeholder="请输入文本" th:value="${delay.creatUser.userName}"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">完成时间：</label>
                <div class="col-sm-9">
                    <input type="text" name="" class="form-control" placeholder="请输入文本" th:value="${#dates.format(delay.info.end_date,'yyyy-MM-dd')}"/>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">延期时间：</label>
                <div class="col-sm-9">
                    <input type="text" name="ddate" class="form-control" placeholder="请输入文本" th:value="${#dates.format(delay.ddate,'yyyy-MM-dd')}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">延期原因：</label>
                <div class="col-sm-9">
                    <textarea type="text" name="" class="form-control" placeholder="请输入文本" th:text="${delay.reason}"></textarea>
                </div>
            </div>
            <label class="col-sm-3 control-label">是否同意：</label>
            <div class="col-sm-9">
                <select class="form-control" name="opinion" id="opinion" >
                    <option>请选择</option>
                    <option value="1">同意</option>
                    <option value="0">不同意</option>
                </select>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">延期到：</label>
                <div class="col-sm-9">
                    <input type="text" name="" class="form-control" placeholder="请输入文本" th:value="${#dates.format(delay.ddate,'yyyy-MM-dd')}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">详细意见：</label>
                <div class="col-sm-9">
                    <textarea type="text" name="opiniondesc" class="form-control" placeholder="请输入文本"></textarea>
                </div>
            </div>
        </div>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: ztree-js"/>
<script type="text/javascript">
    $(function () {
        var url = ctx + "system/menu/roleMenuTreeData";
        var options = {
            id: "menuTrees",
            url: url,
            check: {enable: true},
            expandLevel: 0
        };
        $.tree.init(options);
    });

    $("#form-role-add").validate({
        rules: {
            onkeyup: false,
            roleName: {
                remote: {
                    url: ctx + "system/role/checkRoleNameUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "roleName": function () {
                            return $.common.trim($("#roleName").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            roleKey: {
                remote: {
                    url: ctx + "system/role/checkRoleKeyUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "roleKey": function () {
                            return $.common.trim($("#roleKey").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            roleSort: {
                digits: true
            },
        },
        messages: {
            "roleName": {
                remote: "角色名称已经存在"
            },
            "roleKey": {
                remote: "角色权限已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
        var vals = $("#form-delay-apprv").serialize();
        console.log(vals);
        $.ajax({
            cache: true,
            type: "POST",
            url: ctx + "cms/mm/delay/doApprv",
            data: vals,
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.successCallback(data);
            }
        });
    }
</script>
</body>
</html>
